<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:SitRep="urn:oasis:names:tc:emergency:EDXL:SitRep:1.0" xmlns:Person="urn:oasis:names:tc:emergency:edxl:ct:1.0" xmlns:PersonName="urn:oasis:names:tc:emergency:edxl:ciq:1.0:xnl">
	<xsl:template match="/">			<link rel="stylesheet" href="css/SIStyle.css" type="text/css" media="screen" />
			
			<link rel="stylesheet" href="OpenLayers-2.11/theme/default/style.css"/>
			
			
			
		<!-- keep these commented out when checking it in. The parent dashboard handles loading them. Multiple loads of it equals glitches! -->
		<!--
		<script type="text/javascript" src="OpenLayers-2.11/OpenLayers.js">&#160;</script>
		
		-->
		
			<div style="float: left; width: 50%;">
				<ul>
					
					<li><b>Incident:</b> <xsl:value-of select="SitRep:SitRep/SitRep:IncidentID"/>
					</li>
					<li><b>Message ID:</b> <xsl:value-of select="SitRep:SitRep/SitRep:MessageID"/>
					</li>
					<li><b>Report Confidence:</b> <u>
							<xsl:value-of select="SitRep:SitRep/SitRep:ReportConfidence/Person:Value"/>
						</u>
					</li>
					<li><b>Severity:</b> <u>
							<xsl:value-of select="SitRep:SitRep/SitRep:Severity/SitRep:SeverityDefault/SitRep:Value"/>
						</u>
					</li>
					<li><b>Start:</b> <xsl:value-of select="SitRep:SitRep/SitRep:ForTimePeriod/Person:FromDateTime"/>
					</li>
					<li><b>End:</b> <xsl:value-of select="SitRep:SitRep/SitRep:ForTimePeriod/Person:ToDateTime"/>
					</li>
				</ul>
			</div>
			<div style="float: right; width: 50%;">
				<ul>
					<li><b>Prepared By:</b> <xsl:value-of select="SitRep:SitRep/SitRep:PreparedBy/Person:PersonDetails/PersonName:PersonName/PersonName:NameElement"/>
					</li>
					<li><b>Prepared At:</b> <xsl:value-of select="SitRep:SitRep/SitRep:PreparedBy/Person:TimeValue"/>
					</li>
					<li><b>Authorized By:</b> <xsl:value-of select="SitRep:SitRep/SitRep:AuthorizedBy/Person:PersonDetails/PersonName:PersonName/PersonName:NameElement"/>
					</li>
					<li><b>Authorized At:</b> <xsl:value-of select="SitRep:SitRep/SitRep:AuthorizedBy/Person:TimeValue"/>
					</li>
					<li><b>Report Purpose:</b> <xsl:value-of select="SitRep:SitRep/SitRep:ReportPurpose"/>
					</li>
					<li><b>Report Number:</b> <xsl:value-of select="SitRep:SitRep/SitRep:ReportNumber"/>
					</li>
					<li><b>Report Version:</b> <xsl:value-of select="SitRep:SitRep/SitRep:ReportVersion/SitRep:Version/Person:Value"/>
					</li>
				</ul>
			</div>
			<br/>
			<div style="clear: both; height:380px; width: 760px;" class="collapsableDetail">
				<xsl:attribute name="id">map<xsl:value-of select="SitRep:SitRep/SitRep:MessageID"/></xsl:attribute>
		<script type="text/javascript">        
				<xsl:text disable-output-escaping="yes">			
			<![CDATA[
			
			var lon = -73.87164;
			var lat = 40.82009;
			var zoom = 8;
			var map, layer, selectControl;
			
			function onPopupClose(evt) {
				selectControl.unselect(selectedFeature);
			}
			function onFeatureSelect(feature) {
				selectedFeature = feature;
				popup = new OpenLayers.Popup.FramedCloud("chicken", 
										 feature.geometry.getBounds().getCenterLonLat(),
										 null,
										 "<div style='font-size:.8em'>Incident Name: " + feature.attributes.incidentName +"<br>Description: " + feature.attributes.desc +"</div>",
										 null, true, onPopupClose);
				feature.popup = popup;
				map.addPopup(popup);
			}
			function onFeatureUnselect(feature) {
				map.removePopup(feature.popup);
				feature.popup.destroy();
				feature.popup = null;
			}    

			]]>
		</xsl:text>
							var WGS84 = new OpenLayers.Projection("EPSG:4326");
				var mercator = new OpenLayers.Projection("ESPG:900913");
				var movemap = new OpenLayers.Control.Navigation({'zoomWheelEnabled': false});
				map = new OpenLayers.Map( 'map<xsl:value-of select="SitRep:SitRep/SitRep:MessageID"/>', {
					controls: [
						movemap,
						new OpenLayers.Control.PanZoomBar(),
						new OpenLayers.Control.LayerSwitcher()
					],
					projection: WGS84,
					displayProjection: mercator
				});
				
				layer = new OpenLayers.Layer.OSM( "Simple OSM Map");
				
				var jsonLayer = new OpenLayers.Layer.Vector("Incidents", {
					strategies: [new OpenLayers.Strategy.Fixed()],
					projection: WGS84,
					protocol: new OpenLayers.Protocol.HTTP({
						url: 'geomsample/bomb.json',
						format: new OpenLayers.Format.GeoJSON()
					})
				});
				//jsonLayer.events.register("loadstart", null, function() { /*$("status").innerHTML = "Loading..."; }*/)
				//jsonLayer.events.register("loadend", null, function() { alert('loaded incident polygon'); /*$("status").innerHTML = "";*/ })
				
				map.addLayers([layer, jsonLayer]);           
				
				selectControl = new OpenLayers.Control.SelectFeature(jsonLayer,
                {
					onSelect: onFeatureSelect, 
					onUnselect: onFeatureUnselect
				});
				
				map.addControl(selectControl);
				selectControl.activate();
				
				map.setCenter(
					new OpenLayers.LonLat(lon, lat).transform(
						WGS84,
						map.getProjectionObject()
					), 12
				);    
				
				
				
				 
        </script>
				<xsl:comment/>
			</div>
			
		
	</xsl:template>
</xsl:stylesheet>
